<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>png++: streaming_base.hpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">png++
   &#160;<span id="projectnumber">0.2.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">streaming_base.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="streaming__base_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2007,2008   Alex Shulgin</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * This file is part of png++ the C++ wrapper for libpng.  PNG++ is free</span>
<a name="l00005"></a>00005 <span class="comment"> * software; the exact copying conditions are as follows:</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00008"></a>00008 <span class="comment"> * modification, are permitted provided that the following conditions are met:</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * 1. Redistributions of source code must retain the above copyright notice,</span>
<a name="l00011"></a>00011 <span class="comment"> * this list of conditions and the following disclaimer.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00015"></a>00015 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * 3. The name of the author may not be used to endorse or promote products</span>
<a name="l00018"></a>00018 <span class="comment"> * derived from this software without specific prior written permission.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS&#39;&#39; AND ANY EXPRESS OR</span>
<a name="l00021"></a>00021 <span class="comment"> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</span>
<a name="l00022"></a>00022 <span class="comment"> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN</span>
<a name="l00023"></a>00023 <span class="comment"> * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00024"></a>00024 <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED</span>
<a name="l00025"></a>00025 <span class="comment"> * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR</span>
<a name="l00026"></a>00026 <span class="comment"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span>
<a name="l00027"></a>00027 <span class="comment"> * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING</span>
<a name="l00028"></a>00028 <span class="comment"> * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<a name="l00029"></a>00029 <span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef PNGPP_STREAMING_BASE_HPP_INCLUDED</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define PNGPP_STREAMING_BASE_HPP_INCLUDED</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &quot;<a class="code" href="image__info_8hpp.html">image_info.hpp</a>&quot;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &quot;<a class="code" href="pixel__traits_8hpp.html">pixel_traits.hpp</a>&quot;</span>
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="keyword">namespace </span>png
<a name="l00039"></a>00039 {
<a name="l00040"></a>00040 
<a name="l00045"></a><a class="code" href="classpng_1_1def__image__info__holder.html">00045</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1def__image__info__holder.html" title="The default image_info holder class. Stores image_info member object.">def_image_info_holder</a>
<a name="l00046"></a>00046     {
<a name="l00047"></a>00047     <span class="keyword">public</span>:
<a name="l00048"></a><a class="code" href="classpng_1_1def__image__info__holder.html#a9527f3f9207292565aba95493dfdce2f">00048</a>         <a class="code" href="classpng_1_1def__image__info__holder.html#a9527f3f9207292565aba95493dfdce2f">def_image_info_holder</a>(<a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>)
<a name="l00049"></a>00049             : m_info(info)
<a name="l00050"></a>00050         {
<a name="l00051"></a>00051         }
<a name="l00052"></a>00052 
<a name="l00053"></a><a class="code" href="classpng_1_1def__image__info__holder.html#af595a47a56bdec6d68f7283f4e2efdef">00053</a>         <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <a class="code" href="classpng_1_1def__image__info__holder.html#af595a47a56bdec6d68f7283f4e2efdef">get_info</a>()
<a name="l00054"></a>00054         {
<a name="l00055"></a>00055             <span class="keywordflow">return</span> m_info;
<a name="l00056"></a>00056         }
<a name="l00057"></a>00057 
<a name="l00058"></a>00058     <span class="keyword">private</span>:
<a name="l00059"></a>00059         <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a> m_info;
<a name="l00060"></a>00060     };
<a name="l00061"></a>00061 
<a name="l00067"></a><a class="code" href="classpng_1_1image__info__ref__holder.html">00067</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1image__info__ref__holder.html" title="An image_info holder class. Stores a reference to the image_info object. The image_info object itself...">image_info_ref_holder</a>
<a name="l00068"></a>00068     {
<a name="l00069"></a>00069     <span class="keyword">public</span>:
<a name="l00070"></a><a class="code" href="classpng_1_1image__info__ref__holder.html#ad1f98c90b9d20551e11ee051b662fadf">00070</a>         <a class="code" href="classpng_1_1image__info__ref__holder.html#ad1f98c90b9d20551e11ee051b662fadf">image_info_ref_holder</a>(<a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>)
<a name="l00071"></a>00071             : m_info(info)
<a name="l00072"></a>00072         {
<a name="l00073"></a>00073         }
<a name="l00074"></a>00074 
<a name="l00075"></a><a class="code" href="classpng_1_1image__info__ref__holder.html#a47a51d345f934599ee4413b933cd8a0f">00075</a>         <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <a class="code" href="classpng_1_1image__info__ref__holder.html#a47a51d345f934599ee4413b933cd8a0f">get_info</a>()
<a name="l00076"></a>00076         {
<a name="l00077"></a>00077             <span class="keywordflow">return</span> m_info;
<a name="l00078"></a>00078         }
<a name="l00079"></a>00079 
<a name="l00080"></a>00080     <span class="keyword">private</span>:
<a name="l00081"></a>00081         <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; m_info;
<a name="l00082"></a>00082     };
<a name="l00083"></a>00083 
<a name="l00089"></a>00089     <span class="keyword">template</span>&lt; <span class="keyword">typename</span> pixel, <span class="keyword">class</span> info_holder &gt;
<a name="l00090"></a><a class="code" href="classpng_1_1streaming__base.html">00090</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1streaming__base.html" title="A base class template for consumer and generator classes. Provides default reset() method implementat...">streaming_base</a>
<a name="l00091"></a>00091     {
<a name="l00092"></a>00092     <span class="keyword">public</span>:
<a name="l00093"></a><a class="code" href="classpng_1_1streaming__base.html#a8348458b045db562d76f2032d6b6e138">00093</a>         <span class="keyword">typedef</span> pixel_traits&lt; pixel &gt; <a class="code" href="classpng_1_1streaming__base.html#a8348458b045db562d76f2032d6b6e138">traits</a>;
<a name="l00094"></a>00094 
<a name="l00095"></a><a class="code" href="classpng_1_1streaming__base.html#ae445d18f5c34630f687a9a050bbebe76">00095</a>         <span class="keyword">explicit</span> <a class="code" href="classpng_1_1streaming__base.html#ae445d18f5c34630f687a9a050bbebe76">streaming_base</a>(<a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>)
<a name="l00096"></a>00096             : <a class="code" href="classpng_1_1streaming__base.html#a54ae41876ee5d7e3c2010ebf184608b1">m_info_holder</a>(info)
<a name="l00097"></a>00097         {
<a name="l00098"></a>00098         }
<a name="l00099"></a>00099 
<a name="l00100"></a><a class="code" href="classpng_1_1streaming__base.html#a3e858b8fa76ad63a4bcf6d09d2f7363a">00100</a>         <a class="code" href="classpng_1_1streaming__base.html#ae445d18f5c34630f687a9a050bbebe76">streaming_base</a>(<span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height)
<a name="l00101"></a>00101             : <a class="code" href="classpng_1_1streaming__base.html#a54ae41876ee5d7e3c2010ebf184608b1">m_info_holder</a>(<a class="code" href="namespacepng.html#a0382f7c737de4af757becbb39cc3f5ae" title="Returns an image_info object with color_type and bit_depth fields setup appropriate for the pixel typ...">make_image_info</a>&lt; pixel &gt;())
<a name="l00102"></a>00102         {
<a name="l00103"></a>00103             <a class="code" href="classpng_1_1streaming__base.html#adab066b598745083ed1031f20f702faf">get_info</a>().<a class="code" href="classpng_1_1image__info.html#a3d23fc1552357d39fe4d8d017b9bea0a">set_width</a>(width);
<a name="l00104"></a>00104             <a class="code" href="classpng_1_1streaming__base.html#adab066b598745083ed1031f20f702faf">get_info</a>().<a class="code" href="classpng_1_1image__info.html#a6ccb5704bf7f715572a6129bf3009761">set_height</a>(height);
<a name="l00105"></a>00105         }
<a name="l00106"></a>00106 
<a name="l00107"></a><a class="code" href="classpng_1_1streaming__base.html#adab066b598745083ed1031f20f702faf">00107</a>         <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1streaming__base.html#adab066b598745083ed1031f20f702faf">get_info</a>()<span class="keyword"> const</span>
<a name="l00108"></a>00108 <span class="keyword">        </span>{
<a name="l00109"></a>00109             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1streaming__base.html#a54ae41876ee5d7e3c2010ebf184608b1">m_info_holder</a>.get_info();
<a name="l00110"></a>00110         }
<a name="l00111"></a>00111 
<a name="l00112"></a>00112     <span class="keyword">protected</span>:
<a name="l00113"></a><a class="code" href="classpng_1_1streaming__base.html#a5e2700341b10eecb7086ef3cf715c438">00113</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1streaming__base.html#a5e2700341b10eecb7086ef3cf715c438">reset</a>(<span class="keywordtype">size_t</span> <span class="comment">/*pass*/</span>)
<a name="l00114"></a>00114         {
<a name="l00115"></a>00115             <span class="comment">// nothing to do in the most general case</span>
<a name="l00116"></a>00116         }
<a name="l00117"></a>00117 
<a name="l00118"></a><a class="code" href="classpng_1_1streaming__base.html#a488cef2a7e534a46fef99ebe53c5cf4f">00118</a>         <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <a class="code" href="classpng_1_1streaming__base.html#adab066b598745083ed1031f20f702faf">get_info</a>()
<a name="l00119"></a>00119         {
<a name="l00120"></a>00120             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1streaming__base.html#a54ae41876ee5d7e3c2010ebf184608b1">m_info_holder</a>.get_info();
<a name="l00121"></a>00121         }
<a name="l00122"></a>00122 
<a name="l00123"></a><a class="code" href="classpng_1_1streaming__base.html#a54ae41876ee5d7e3c2010ebf184608b1">00123</a>         info_holder <a class="code" href="classpng_1_1streaming__base.html#a54ae41876ee5d7e3c2010ebf184608b1">m_info_holder</a>;
<a name="l00124"></a>00124     };
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 } <span class="comment">// namespace png</span>
<a name="l00127"></a>00127 
<a name="l00128"></a>00128 <span class="preprocessor">#endif // PNGPP_STREAMING_BASE_HPP_INCLUDED</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri Jan 25 2013 14:10:10 for png++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
